package SOEN_Phase_2;

import junit.framework.TestCase;
import junit.framework.Assert;

import java.awt.event.ActionEvent;

public class TaskCreationDialogTest extends TestCase {
	
	public void testTaskCreationDialog() {
		TaskTable tt = new TaskTable("tasks.xml");
		PersonTable pt = new PersonTable(tt);
		
		TaskCreationDialog tcd = new TaskCreationDialog(tt,pt);
		
		assertTrue("Problem with TaskCreationDialog(): Test 1", !tcd.isVisible());		//since TaskCreationDialog is set as invisible, the opposite should be true
		tcd.actionPerformed(null);
		assertTrue("Problem with TaskCreationDialog(): Test 2", tcd.isVisible());
	}
	
	public void testActionPerformed() {
		TaskTable tt = new TaskTable("tasks.xml");
		PersonTable pt = new PersonTable(tt);
		
		TaskCreationDialog tcd = new TaskCreationDialog(tt,pt);
		
		tcd.actionPerformed(new ActionEvent(new Object(), 0, "", 0));
		
		assertTrue("Problem with ActionPerformed()" , tcd.isVisible());
	}

}
